﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Class_KetNoi
{
   public class KetNoi_KyLuat:KetNoiCoSoDuLieu
    {
       public void them_KyLuat( string @TenKL, string @MaNV, string @NgayKL, string @HinhThuc, string @NguyenNhan)
       {
           SqlCommand cmd = new SqlCommand("dbo.insert_KiLuat", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@TenKL", TenKL);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@MaNV",Convert.ToInt32(MaNV));
           cmd.Parameters.Add(p);
           p = new SqlParameter("@NgayKL",Convert.ToDateTime( NgayKL));
           cmd.Parameters.Add(p);
           p = new SqlParameter("@HinhThuc",HinhThuc);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@NguyenNhan", NguyenNhan);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
       public void sua_KyLuat(string @MaKL, string @TenKL, string @MaNV, string @NgayKL, string @HinhThuc, string @NguyenNhan)
       {
           SqlCommand cmd = new SqlCommand("dbo.update_KiLuat", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@MaKL",MaKL);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@TenKL", TenKL);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@MaNV", Convert.ToInt32(MaNV));
           cmd.Parameters.Add(p);
           p = new SqlParameter("@NgayKL", Convert.ToDateTime(NgayKL));
           cmd.Parameters.Add(p);
           p = new SqlParameter("@HinhThuc", HinhThuc);
           cmd.Parameters.Add(p);
           p = new SqlParameter("@NguyenNhan", NguyenNhan);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
       public void xoa_KyLuat(string @MaKL)
       {
           SqlCommand cmd = new SqlCommand("dbo.insert_KiLuat", cnn);
           cmd.CommandType = CommandType.StoredProcedure;
           SqlParameter p = new SqlParameter("@MaKL",MaKL);
           cmd.Parameters.Add(p);
           cmd.ExecuteNonQuery();
       }
    }
}
